package com.jzlin.alltools.controller;

import com.jzlin.alltools.core.http.RestRet;
import com.jzlin.alltools.service.ToolSupportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 在线工具控制器.
 *
 * @author linjz
 * @date 2024/9/14
 */
@Api(tags ={"在线工具"})
@RestController
@RequestMapping("/tool")
public class ToolController {
    @Autowired
    private ToolSupportService toolSupportService;

    @ApiOperation("获取ip信息")
    @GetMapping("/getIpInfo")
    public RestRet getIpInfo(@RequestParam(value = "ip", required = false) String ip, HttpServletRequest request) {
        return RestRet.createSuccessRet(toolSupportService.getIPInfo(ip, request));
    }
}
